package com.bdqn.boot.yuanshen.service.impl;

import com.bdqn.boot.yuanshen.bean.Videos;
import com.bdqn.boot.yuanshen.mapper.VideosMapper;
import com.bdqn.boot.yuanshen.service.VideosService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Hasee
 * @version 1.0
 * @className VideosServiceimpl
 * @description TODD
 * @date 2025/3/17 10:32
 */
@Service
public class VideosServiceimpl implements VideosService {
    @Autowired
    private VideosMapper videosMapper;

    @Override
    public List<Videos> getVideos() {
        return videosMapper.getVideos();
    }

    @Override
    public PageInfo<Videos> getVideosPage(int pageNum, int pageSize) {

        PageHelper.startPage(pageNum, pageSize);
        List<Videos> videosList = videosMapper.getVideos();
        return new PageInfo<>(videosList);
    }

    @Override
    public Videos getVideosId(Integer id) {
        return videosMapper.getVideosId(id);
    }

    @Override
    public void updateVideos(Videos videos) {
        videosMapper.updateVideos(videos);
    }

    @Override
    public void deleteVideos(int id) {
        videosMapper.deleteVideos(id);
    }

    @Override
    public void addVideos(Videos videos) {
        videosMapper.addVideos(videos);
    }

    @Override
    public List<Videos> getVideosByUserId(Integer userId) {
        return videosMapper.getVideosByUserId(userId);
    }
}
